package com.sky.mapper;

import com.sky.dto.GoodsSalesDTO;
import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderDetailMapper {
    /**
     * 批量插入订单明细表
     * @param orderDetails
     */
    void insert(ArrayList<OrderDetail> orderDetails);

    /**
     * 根据订单id查询该订单的明细集合
     * @param orderId
     * @return
     */
    @Select("select * from order_detail where order_id = #{orderId}")
    List<OrderDetail> getDetailByOrderId(Long orderId);

    /**
     * 销量统计
     * @param map
     * @return
     */
    List<GoodsSalesDTO> top10(Map map);
}
